using Domain.ActiveDirectory.Provider;
using Domain.Context;
using Domain.Provider;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebUI.Models;

namespace WebUI.Controllers
{
    public class HomeController : Controller
    {
        private IActiveDirectoryDataProvider _dataProvider;
        private IDataProvider<ManagerHours> _repository;

        public HomeController(IActiveDirectoryDataProvider dataProvider, IDataProvider<ManagerHours> repository)
        {
            _dataProvider = dataProvider;
            _repository = repository;
        }

        public ActionResult Index()
        {
            var user = _dataProvider.GetUsersByUsername(User.Identity.Name).FirstOrDefault();
            ViewBag.User = user;
            var entities = _repository.Entities.Select(x => x.District).Distinct();
            return View(entities);
        }
    }
}